Skip to content

Feat/verification configurable pipeline#200

Open
shrutu0929 wants to merge 4 commits into
Refactron-ai:mainfrom
shrutu0929:feat/verification-configurable-pipeline
Open

Feat/verification configurable pipeline#200
shrutu0929 wants to merge 4 commits into
Refactron-ai:mainfrom
shrutu0929:feat/verification-configurable-pipeline

Conversation

@shrutu0929
Copy link
Copy Markdown

solve #193
This change makes Refactron's verification pipeline configurable instead of hard-coded. Previously the pipeline used a fixed 45-second test-gate timeout, a fixed list and ordering of checks baked into VerificationEngine.init, and offered no first-class way to disable a check — for example skipping the slow test gate in a quick PR pipeline — without editing source code. As a result teams could not tune the safety-versus-speed trade-off for their repository size, CI tier, or review policy. This change introduces a VerificationConfig dataclass, surfaced as an optional verification: section of RefactronConfig, with four settings: enabled_checks (which checks run, and in what order), short_circuit (stop on first failure versus run them all), test_gate_timeout_sec, and pytest_extra_args. The config is loaded and saved through the existing from_file/to_file machinery, with a clear error message for invalid keys. VerificationEngine now accepts a VerificationConfig, builds its check list from enabled_checks (raising a clear ValueError on an unknown check name), and verify() falls back to the configured short_circuit value when a caller does not pass one explicitly. TestSuiteGate takes timeout_sec and pytest_extra_args parameters in place of the hard-coded timeout and fixed pytest command line. The refactron verify CLI gains a --config flag that threads the verification: section into the engine, while the existing --all-checks flag still overrides short_circuit. The configuration.mdx documentation gains a section covering the new keys, a defaults table, common recipes, and a migration note: the verification: section is entirely optional, and a config file without it reproduces the exact behaviour of earlier releases, so no action is required to upgrade. Thirteen new tests in test_verification_config.py cover the defaults, engine wiring, timeout threading, and config-file round-tripping, and all 67 verification tests pass. Note that the issue also mentioned refactron autofix --verify and refactron run; autofix is currently a stub that does not actually run verification and there is no refactron run command, so there was nothing live to thread config into there — config is fully wired into refactron verify and the VerificationEngine itself, so those commands will pick it up once implemented. This commit also folds in the earlier verification work it builds on: machine-readable JSON output for refactron verify, the run-all (--all-checks) mode, import cycle detection in ImportIntegrityVerifier, and package-aware TestSuiteGate relevance matching.

shrutu0929 and others added 3 commits April 7, 2026 18:31
TestSuiteGate.verify ran pytest via a hard-coded python3 interpreter
with cwd set to file_path.parent. For nested files this misses the
repo's pyproject.toml / pytest.ini / conftest.py and may use a
different interpreter/venv than the host process, causing false
positives or undiscovered tests and CI-vs-local mismatch.

- Run pytest via sys.executable instead of python3.
- Set cwd to the resolved project root (project_root or file dir).
- Prepend the project root to PYTHONPATH for layouts that rely on it.
- Add tests asserting the interpreter, cwd, and PYTHONPATH.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Verification behaviour was mostly hard-coded: a fixed 45s test-gate
timeout, a fixed check list and order, and no way to disable a check
(e.g. the slow test gate) without code changes. Teams could not tune
safety vs speed for their repo size, CI tier, or policy.

- config.py: new VerificationConfig dataclass exposed as a
  `verification:` section of RefactronConfig — enabled_checks (which
  checks run, and in what order), short_circuit, test_gate_timeout_sec,
  and pytest_extra_args; loaded/saved via from_file/to_file
- engine.py: VerificationEngine accepts a VerificationConfig, builds
  its checks from enabled_checks (unknown names raise a clear error),
  and verify() falls back to the configured short_circuit value
- test_gate.py: TestSuiteGate takes timeout_sec and pytest_extra_args
  instead of a hard-coded 45s timeout and fixed pytest command
- verify CLI: new --config flag threads the verification section into
  the engine; --all-checks still overrides short_circuit
- docs: configuration.mdx documents defaults and migration (the
  section is optional; absent config reproduces prior behaviour)

Also folds in the earlier verification work this builds on: JSON
output (`refactron verify --json`), the run-all (--all-checks) mode,
import cycle detection in ImportIntegrityVerifier, and package-aware
TestSuiteGate relevance matching.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

Warning

Rate limit exceeded

@shrutu0929 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 58 minutes and 12 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f66f48c-af51-4b1a-a904-bc1459e6bbe0

📥 Commits

Reviewing files that changed from the base of the PR and between 2f04295 and 72b4ed6.

📒 Files selected for processing (14)
  • docs/essentials/configuration.mdx
  • refactron/cli/main.py
  • refactron/cli/verify.py
  • refactron/core/config.py
  • refactron/verification/checks/imports.py
  • refactron/verification/checks/test_gate.py
  • refactron/verification/engine.py
  • refactron/verification/report.py
  • refactron/verification/result.py
  • tests/test_import_verifier.py
  • tests/test_test_gate.py
  • tests/test_verification_config.py
  • tests/test_verification_engine.py
  • tests/test_verification_result.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant